<script setup lang="ts">
const props = defineProps(['close', 'isOpen', 'mask', 'title', 'height', 'width'])

</script>

<template>
    <div class="mask" v-if="isOpen">
        <div class="model-box" :style="{ height: props.height + 'px', width: props.width + 'px' }">
            <div class="title">
                <div>{{ props.title }}
                    <i @click="props.close">X</i>
                </div>
            </div>
            <slot></slot>
        </div>
    </div>
</template>

<style lang="css" scoped>
.mask {
    z-index: 9999;
    position: fixed;
    height: 100vh;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    left: 0;
    top: 0;
}

.model-box .title i {
    font-size: 15px;
    color: #FFFFFF;
    cursor: pointer;
    float: right;
    margin-right: 20px;
    text-decoration: none;
    font-style: normal;
}

.model-box .title {
    height: 35px;
    width: 100%;
    color: #FFFFFF;
    font-weight: bold;
    line-height: 35px;
    padding-left: 20px;
    box-sizing: border-box;
    background-color: #2D2D2D;
    border-top: #242424;
    border-radius: 5px 5px 0 0;
}

.model-box {
    --login-box-height: 300px;
    --login-box-width: 500px;
    position: absolute;
    display: flex;
    left: calc(50% - var(--login-box-width)/2);
    top: calc(50% - var(--login-box-height)/2);
    height: var(--login-box-height);
    width: var(--login-box-width);
    background-color: #FFFFFF;
    border-radius: 5px 5px 0 0;
    flex-direction: column;
}
</style>